<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="departmentDetail.title"/></title>
    <meta name="heading" content="<fmt:message key='departmentDetail.heading'/>"/>
</head>

<c:set var="delObject" scope="request"><fmt:message key="departmentList.department"/></c:set>
<script type="text/javascript">var msgDelConfirm =
   "<fmt:message key="delete.confirm"><fmt:param value="${delObject}"/></fmt:message>";
</script>

<div class="span2">
    <h2><fmt:message key="departmentDetail.heading"/></h2>
    <fmt:message key="departmentDetail.message"/>
</div>

<div class="span7">
    <s:form id="departmentForm" action="saveDepartment" method="post" validate="true" cssClass="well form-horizontal">
        <s:hidden key="department.id"/>
        <s:textfield key="department.name" required="true" maxlength="50" />

        <div id="actions" class="form-actions">
            <s:submit type="button" cssClass="btn btn-primary" method="save" key="button.save" theme="simple">
                <i class="icon-ok icon-white"></i> <fmt:message key="button.save"/>
            </s:submit>
            <c:if test="${not empty department.id}">
                <s:submit type="button" cssClass="btn btn-warning" method="delete" key="button.delete"
                    onclick="return confirmMessage(msgDelConfirm)" theme="simple">
                    <i class="icon-trash icon-white"></i> <fmt:message key="button.delete"/>
                </s:submit>
            </c:if>
            <s:submit type="button" cssClass="btn" method="cancel" key="button.cancel" theme="simple">
                <i class="icon-remove"></i> <fmt:message key="button.cancel"/>
            </s:submit>
        </div>
    </s:form>
    <h2>Notices</h2>
	<div class="controls">
			<a href="editNotice"/>Add Notice</a>
	</div>
	</p>
    <display:table name="department.notices" class="table table-condensed table-striped table-hover" requestURI="" id="noticeList" export="true" pagesize="25">
        <display:column property="id" sortable="true" href="editNotice" media="html"
            paramId="id" paramProperty="id" titleKey="notice.id"/>
        <display:column property="id" media="csv excel xml pdf" titleKey="notice.id"/>
        <display:column property="postDate" sortable="true" titleKey="notice.postDate"/>
        <display:column property="title" sortable="true" titleKey="notice.title"/>
        <display:column property="viewTimes" sortable="true" titleKey="notice.viewTimes"/>

        <display:setProperty name="paging.banner.item_name"><fmt:message key="noticeList.notice"/></display:setProperty>
        <display:setProperty name="paging.banner.items_name"><fmt:message key="noticeList.notices"/></display:setProperty>

        <display:setProperty name="export.excel.filename"><fmt:message key="noticeList.title"/>.xls</display:setProperty>
        <display:setProperty name="export.csv.filename"><fmt:message key="noticeList.title"/>.csv</display:setProperty>
        <display:setProperty name="export.pdf.filename"><fmt:message key="noticeList.title"/>.pdf</display:setProperty>
    </display:table>
</div>

<script type="text/javascript">
    $(document).ready(function() {
        $("input[type='text']:visible:enabled:first", document.forms['departmentForm']).focus();
    });
</script>
